/**
 * Created by YongX on 2017/5/27.
 */
import Router from 'vue-router';

const Index = resolve => require(['@/components/Index.vue'], resolve);
const Login = resolve => require(['@/components/user/LoginPage.vue'], resolve);
const SigUp = resolve => require(['@/components/user/SigUp.vue'], resolve);
const DashBoard = resolve => require(['@/components/admin/DashBoard.vue'], resolve);
const ProductList = resolve => require(['@/components/admin/goods/List.vue'], resolve);
const ProductCategory = resolve => require(['@/components/admin/goods/Category.vue'], resolve);
const ProductEdit = resolve => require(['@/components/admin/goods/Edit.vue'], resolve);
const ProductInsert = resolve => require(['@/components/admin/goods/Insert.vue'], resolve);
const UserList = resolve => require(['@/components/admin/user/List.vue'], resolve);
const UserAdd = resolve => require(['@/components/admin/user/Add.vue'], resolve);
const Authority = resolve => require(['@/components/admin/user/Authority.vue'], resolve);
const WebSetting = resolve => require(['@/components/admin/WebSetting.vue'], resolve);
const Passport = resolve => require(['@/components/admin/Passport.vue'], resolve);

const TestComponent = resolve => require(['@/components/TestComponent.vue'], resolve);
export default new Router({
    mode: 'history',
    base: __dirname,
    routes: [
        {path: '/', name: '/', component: Index},
        {path: '/home', name: 'Home', component: DashBoard},
        {path: '/login', name: 'Login', component: Login},
        {path: '/register', name: 'Register', component: SigUp},
        {path: '/admin/dashboard', name: 'DashBoard', component: DashBoard},
        {path: '/admin/user/list', name: 'UserList', component: UserList},
        {path: '/admin/user/add', name: 'UserAdd', component: UserAdd},
        {path: '/admin/user/authority', name: 'Authority', component: Authority},
        {path: '/admin/goods/category', name: 'ProductCategory', component: ProductCategory},
        {path: '/admin/goods/list', name: 'ProductList', component: ProductList},
        {path: '/admin/goods/insert', name: 'ProductInsert', component: ProductInsert},
        {path: '/admin/goods/edit/:id', name: 'ProductEdit', component: ProductEdit},
        {path: '/admin/setting', name: 'WebSetting', component: WebSetting},
        {path: '/admin/passport', name: 'Passport', component: Passport},

        {path: '/test', name: 'Test', component: TestComponent},
        {path: '*', redirect: '/'}
    ]
});
